Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Stop calling eglSwapBuffers immediately. #3076

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

jellefoks
Copy link
Member

Since we're seeing ANRs at SCREEN_OFF where the rasterizer thread appears to be hanging during eglSwapBuffers, this change attempts to avoid those ANRs by immediately skip calls to eglSwapBuffers when a surfaceDestroyed event is received, until a the next SurfaceCreated. Since Cobalt uses GameActivity, those are received in calls to OnNativeWindowDestroyed respectively OnNativeWindowCreated.

b/225209442

Since we're seeing ANRs at SCREEN_OFF where the rasterizer thread appears to
be hanging during eglSwapBuffers, this change attempts to avoid those ANRs
by immediately skip calls to eglSwapBuffers when a surfaceDestroyed event is
received, until a the next SurfaceCreated.  Since Cobalt uses GameActivity,
those are received in calls to OnNativeWindowDestroyed respectively
OnNativeWindowCreated.

b/225209442
Copy link
Contributor

@zhongqiliang zhongqiliang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change LGTM, there is chance this can reduce ANRs.

However, there is also risk that this change can cause unexpected crash or ANRs. I want to flag that we should be prepared to stop the release candidate at 5% if anything bad happens.

@jellefoks jellefoks merged commit ad53292 into youtube:main Apr 30, 2024
297 of 298 checks passed
@jellefoks jellefoks added the cp-25.lts.1+ Cherry Pick to the 25.lts.1+ branch label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cp-25.lts.1+ Cherry Pick to the 25.lts.1+ branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants